<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <!-- Chrome, Opera, and Firefox OS -->
    <meta name="theme-color" content="#3a3f51" />
    <!-- Windows Phone -->
    <meta name="msapplication-navbutton-color" content="#3a3f51" />
    <!-- Android/Apple Phone -->
    <meta name="mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta
      name="apple-mobile-web-app-status-bar-style"
      content="black-translucent"
    />
    <meta name="format-detection" content="telephone=no" />

    <meta name="description" content="Sonarr" />

    <link
      rel="apple-touch-icon"
      sizes="180x180"
      href="/Content/Images/Icons/apple-touch-icon.png"
    />
    <link
      rel="icon"
      type="image/png"
      sizes="32x32"
      href="/Content/Images/Icons/favicon-32x32.png"
    />
    <link
      rel="icon"
      type="image/png"
      sizes="16x16"
      href="/Content/Images/Icons/favicon-16x16.png"
    />
    <link
      rel="manifest"
      href="/Content/manifest.json"
      crossorigin="use-credentials"
    />
    <link
      rel="mask-icon"
      href="/Content/Images/Icons/safari-pinned-tab.svg"
      color="#00ccff"
    />
    <link
      rel="shortcut icon"
      type="image/ico"
      href="/favicon.ico"
      data-no-hash
    />
    <meta name="msapplication-config" content="/Content/browserconfig.xml" />

    <link rel="stylesheet" type="text/css" href="/Content/styles.css" />
    <link rel="stylesheet" type="text/css" href="/Content/Fonts/fonts.css" />

    <title>Login - Sonarr</title>

    <style>
      body {
        background-color: var(--pageBackground);
        color: var(--textColor);
        font-family: 'Roboto', 'open sans', 'Helvetica Neue', Helvetica, Arial,
          sans-serif;
      }

      .center {
        display: flex;
        justify-content: center;
      }

      .content {
        flex: 0 0 325px;
      }

      .logo {
        width: 32px;
        height: 32px;
      }

      .panel {
        margin-top: 50px;
        border-radius: 4px;
      }

      .panel-header {
        display: flex;
        justify-content: center;
        padding: 10px;
        border-top-left-radius: 4px;
        border-top-right-radius: 4px;
        background-color: var(--themeDarkColor);
      }

      .panel-body {
        padding: 20px;
        border-bottom-right-radius: 4px;
        border-bottom-left-radius: 4px;
        background-color: var(--panelBackground);
      }

      .sign-in {
        padding: 10px 0;
        text-align: center;
      }

      .form-group {
        margin: 20px 0;
      }

      .form-input {
        box-sizing: border-box;
        padding: 6px 16px;
        width: 100%;
        height: 35px;
        background-color: var(--inputBackgroundColor);
        border: 1px solid var(--inputBorderColor);
        border-radius: 4px;
        box-shadow: inset 0 1px 1px var(--inputBoxShadowColor);
        color: var(--textColor);
      }

      .form-input:focus {
        outline: 0;
        border-color: var(--inputFocusBorderColor);
        box-shadow: inset 0 1px 1px var(--inputBoxShadowColor),
          0 0 8px var(--inputFocusBoxShadowColor);
      }

      .button {
        overflow: hidden;
        margin-top: 20px;
        padding: 10px 0;
        width: 100%;
        border: 1px solid;
        border-color: var(--primaryBorderColor);
        border-radius: 4px;
        background-color: var(--primaryBackgroundColor);
        color: var(--white);
        vertical-align: middle;
        text-align: center;
        white-space: nowrap;
        line-height: normal;
      }

      .button:hover {
        border-color: var(--primaryHoverBorderColor);
        background-color: var(--primaryHoverBackgroundColor);
        color: var(--white);
        text-decoration: none;
      }

      .copy {
        margin-top: 15px;
        text-align: center;
        font-size: 14px;
      }

      .remember-me-container {
        display: flex;
        justify-content: space-between;
        line-height: 25px;
      }

      .remember-me {
        font-size: 14px;
      }

      .forgot-password {
        margin-left: auto;
        color: var(--forgotPasswordColor);
        text-decoration: none;
        font-size: 13px;
      }

      .forgot-password:focus,
      .forgot-password:hover {
        color: var(--forgotPasswordAltColor);
        text-decoration: underline;
      }

      .forgot-password:visited {
        color: var(--forgotPasswordAltColor);
      }

      .login-failed {
        margin-top: 20px;
        color: var(--failedColor);
        font-size: 14px;
      }

      .hidden {
        display: none;
      }

      @media only screen and (min-device-width: 375px) and (max-device-width: 812px) {
        .form-input {
          font-size: 16px;
        }
      }
    </style>
  </head>

  <body>
    <div class="center">
      <div class="content">
        <div class="panel">
          <div class="panel-header">
            <img src="/Content/Images/logo.svg" alt="Image" class="logo" />
          </div>

          <div class="panel-body">
            <div class="sign-in">SIGN IN TO CONTINUE</div>

            <form
              role="form"
              data-parsley-validate=""
              novalidate=""
              class="mb-lg"
              method="POST"
            >
              <div class="form-group">
                <input
                  type="email"
                  name="username"
                  class="form-input"
                  placeholder="Username"
                  autocomplete="off"
                  pattern=".{1,}"
                  required
                  title="User name is required"
                  autofocus="true"
                  autocapitalize="false"
                />
              </div>

              <div class="form-group">
                <input
                  type="password"
                  name="password"
                  class="form-input"
                  placeholder="Password"
                  required
                />
              </div>

              <div class="remember-me-container">
                <span class="remember-me">
                  <input
                    type="checkbox"
                    name="rememberMe"
                    id="rememberMe"
                    checked="checked"
                  />
                  <label for="rememberMe">Remember Me</label>
                </span>

                <a
                  href="https://wiki.servarr.com/sonarr/faq#help-i-have-locked-myself-out"
                  class="forgot-password"
                  >Forgot your password?</a
                >
              </div>
              <button type="submit" class="button">Login</button>

              <div id="login-failed" class="login-failed hidden">
                Incorrect Username or Password
              </div>
            </form>
          </div>
        </div>

        <div id="copy" class="copy hidden">
          <span>&copy;</span>
          <span id="year"></span>
          <span>-</span>
          <span>Sonarr</span>
        </div>
      </div>
    </div>
  </body>

  <script type="text/javascript">
    var yearSpan = document.getElementById('year');
    yearSpan.innerHTML = '2010-' + new Date().getFullYear();

    var copyDiv = document.getElementById('copy');
    copyDiv.classList.remove('hidden');

    if (window.location.search.indexOf('loginFailed=true') > -1) {
      var loginFailedDiv = document.getElementById('login-failed');

      loginFailedDiv.classList.remove('hidden');
    }

    var light = {
      white: '#fff',
      pageBackground: '#f5f7fa',
      textColor: '#515253',
      themeDarkColor: '#3a3f51',
      panelBackground: '#fff',
      inputBackgroundColor: '#fff',
      inputBorderColor: '#dde6e9',
      inputBoxShadowColor: 'rgba(0, 0, 0, 0.075)',
      inputFocusBorderColor: '#66afe9',
      inputFocusBoxShadowColor: 'rgba(102, 175, 233, 0.6)',
      primaryBackgroundColor: '#5d9cec',
      primaryBorderColor: '#5899eb',
      primaryHoverBackgroundColor: '#4b91ea',
      primaryHoverBorderColor: '#3483e7',
      failedColor: '#f05050',
      forgotPasswordColor: '#909fa7',
      forgotPasswordAltColor: '#748690',
    };

    var dark = {
      white: '#fff',
      pageBackground: '#202020',
      textColor: '#ccc',
      themeDarkColor: '#494949',
      panelBackground: '#111',
      inputBackgroundColor: '#333',
      inputBorderColor: '#dde6e9',
      inputBoxShadowColor: 'rgba(0, 0, 0, 0.075)',
      inputFocusBorderColor: '#66afe9',
      inputFocusBoxShadowColor: 'rgba(102, 175, 233, 0.6)',
      primaryBackgroundColor: '#5d9cec',
      primaryBorderColor: '#5899eb',
      primaryHoverBackgroundColor: '#4b91ea',
      primaryHoverBorderColor: '#3483e7',
      failedColor: '#f05050',
      forgotPasswordColor: '#737d83',
      forgotPasswordAltColor: '#546067',
    };

    var theme = '_THEME_';
    var defaultDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
    var finalTheme =
      theme === 'dark' || (theme === 'auto' && defaultDark) ? dark : light;

    Object.entries(finalTheme).forEach(([key, value]) => {
      document.documentElement.style.setProperty(`--${key}`, value);
    });
  </script>
</html>
